import tkinter as tk

win = tk.Tk()
win.geometry("500x300")

txt = tk.Text(selectbackground="red", insertbackground="blue", spacing2=10, bd=0)
txt.pack(fill=tk.BOTH, expand=True)
txt.insert(tk.END, "在最后插入一段内容\r\n")
for i in range(1, 10):
    for j in range(1, i + 1):
        txt.insert(tk.END, f"{j}x{i}={i * j} ")
    txt.insert(tk.END, "\r\n")

win.mainloop()